import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 表单列表 */
export const getGuestbooks = () => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_index/index'),
  );
};

/** 添加表单 */
export const postGuestbooks = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_index/save'),
    data,
  );
};

/** 更新表单 */
export const putGuestbooks = (data: object) => {
  return requestClient.put<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_index/update'),
    data,
  );
};

/** 删除表单 */
export const deleteGuestbooks = (data: object) => {
  return requestClient.delete<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_index/delete'),
    data,
  );
};

/** 表单字段列表 */
export const getGuestbookFields = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_field/index'),
    { params },
  );
};

/** 添加表单字段 */
export const postGuestbookFields = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_field/save'),
    data,
  );
};

/** 更新表单字段 */
export const putGuestbookFields = (data: object) => {
  return requestClient.put<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_field/update'),
    data,
  );
};

/** 删除表单字段 */
export const deleteGuestbookFields = (data: object) => {
  return requestClient.delete<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_field/delete'),
    data,
  );
};

/** 更新表单字段状态 */
export const putGuestbookFieldsStatus = (data: object) => {
  return requestClient.put<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_field/status'),
    data,
  );
};

/** 更新表单字段排序 */
export const postGuestbookFieldsListOrder = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_field/listOrder'),
    data,
  );
};

/** 表单信息列表 */
export const getGuestbookMessages = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_messages/index'),
    { params },
  );
};

/** 删除表单信息 */
export const deleteGuestbookMessages = (data: object) => {
  return requestClient.delete<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_messages/delete'),
    data,
  );
};

/** 更新表单信息状态 */
export const putGuestbookMessagesStatus = (data: object) => {
  return requestClient.put<Result>(
    baseUrlApi('/plugin/guestbook/api_admin_messages/status'),
    data,
  );
};
